Micron Document
<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Tree kernel</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Tree_kernel"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Tree_kernel rootpage-Tree_kernel skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Tree kernel</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr"><p>In <a href="Machine_learning" title="Machine learning">machine learning</a>, <b>tree kernels</b> are the application of the more general concept of <a href="Positive-definite_kernel" title="Positive-definite kernel">positive-definite kernel</a> to tree structures. They find applications in <a href="Natural_language_processing" title="Natural language processing">natural language processing</a>, where they can be used for <a href="Machine_learning" title="Machine learning">machine-learned</a> <a href="Parsing" title="Parsing">parsing</a> or classification of sentences.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Motivation">Motivation</h2></div>
<p>In natural language processing, it is often necessary to compare tree structures (e.g. <a href="Parse_tree" title="Parse tree">parse trees</a>) for similarity. Such comparisons can be performed by computing <a href="Dot_product" title="Dot product">dot products</a> of vectors of features of the trees, but these vectors tend to be very large: NLP techniques have come to a point where a simple dependency relation over two words is encoded with a vector of several millions of features.<sup id="cite_ref-1" class="reference"><a href="#cite_note-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> It can be impractical to represent complex structures such as trees with features vectors. Well-designed kernels allow computing similarity over trees without explicitly computing the feature vectors of these trees. Moreover, <a href="Kernel_methods" class="mw-redirect" title="Kernel methods">kernel methods</a> have been widely used in machine learning tasks (e.g. <a href="Support_vector_machine" title="Support vector machine">SVM</a>), and thus plenty of algorithms are working natively with kernels, or have an extension that handles <a href="Kernel_trick" class="mw-redirect" title="Kernel trick">kernelization</a>.
</p><p>An example application is classification of sentences, such as different types of questions.<sup id="cite_ref-zhang_2-0" class="reference"><a href="#cite_note-zhang-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="Examples">Examples</h2></div>


<p>Here are presented two examples of tree kernel applied to the constituency trees of the sentences "A cat eats a mouse." and "A mouse eats a cat.". In this example "A" and "a" are the same words, and in most of the NLP applications they would be represented with the same token.
</p><p>The interest of these two kernels is that they show very different granularity (the subset tree kernel being far more fine-grained than the subtree kernel), for the same computational complexity. Both can be computed recursively in time <i>O(|T<sub>1</sub>|.|T<sub>2</sub>|)</i>.<sup id="cite_ref-collins_3-0" class="reference"><a href="#cite_note-collins-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading3"><h3 id="Subtree_kernel">Subtree kernel</h3></div>
<p>In the case of constituency tree, a subtree is defined as a node and all its children (e.g., [NP [D [A]] [N [mouse]]] is a subtree of the two trees). Terminals are not considered subtree (e.g. [a] is not a subtree). The subtree kernel count the number of common subtrees between two given trees.
</p><p>In this example, there are seven common subtrees:
</p>
<dl><dd>[NP [D [a]] [N [cat]]],</dd>
<dd>[NP [D [a]] [N [mouse]]],</dd>
<dd>[N [mouse]],</dd>
<dd>[N [cat]],</dd>
<dd>[V [eats]],</dd>
<dd>[D [a]] (counted twice as it appears twice).</dd></dl>
<div class="mw-heading mw-heading3"><h3 id="Subset_tree_kernel">Subset tree kernel</h3></div>
<p>A subset tree is a more general structure than a subtree. The basic definition is the same, but in the case of subset trees, leaves need not be terminals (e.g., [VP [V] [NP]] is a subset tree of both trees), but here two single nodes are not considered as trees. Because of this more general definition, there are more subset trees than subtrees, and more common subset trees than common subtrees.
</p><p>In this example, there are 54 common subset trees. The seven common subtrees plus among others:
</p>
<dl><dd>[NP [D] [N]] (counted twice),</dd>
<dd>[VP [V [eats]] [NP]]...</dd></dl>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Graph_kernel" title="Graph kernel">Graph kernel</a></li>
<li><a href="Parse_tree" title="Parse tree">Parse tree</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="Notes">Notes</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */


.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}


/* end https://en.wikipedia.org/ */
</style><div class="reflist">
<div class="mw-references-wrap"><ol class="references">
<li id="cite_note-1"><span class="mw-cite-backlink"><b><a href="#cite_ref-1">^</a></b></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */


.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}


/* end https://en.wikipedia.org/ */
</style><cite id="CITEREFMcDonaldPereiraRibarovHajič2005" class="citation conference cs1">McDonald, Ryan; Pereira, Fernando; Ribarov, Kiril; Hajič, Jan (2005). <a rel="nofollow" class="external text" href="https://www.aclweb.org/anthology/H05-1066/"><i>Non-projective Dependency Parsing using Spanning Tree Algorithms</i></a>. HLT–EMNLP.</cite></span>
</li>
<li id="cite_note-zhang-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-zhang_2-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFZhangLee2003" class="citation conference cs1">Zhang, Dell; Lee, Wee Sun (2003). <i>Question classification using support vector machines</i>. SIGIR.</cite></span>
</li>
<li id="cite_note-collins-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-collins_3-0">^</a></b></span> <span class="reference-text"><cite id="CITEREFCollinsDuffy2001" class="citation conference cs1"><a href="Michael_Collins_(computational_linguist)" title="Michael Collins (computational linguist)">Collins, Michael</a>; Duffy, Nigel (2001). <i>Convolution kernels for natural language</i>. <a href="Conference_on_Neural_Information_Processing_Systems" title="Conference on Neural Information Processing Systems">Advances in Neural Information Processing Systems</a>.</cite></span>
</li>
</ol></div></div>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<ul><li>Jun Sun, Min Zhang and Chew Lim Tan. <i>Tree Sequence Kernel for Natural Language</i></li>
<li>Alessandro Moschitti. <i>Making Tree Kernels practical for Natural Language Learning</i></li></ul>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="http://disi.unitn.it/moschitti/Tree-Kernel.htm">http://disi.unitn.it/moschitti/Tree-Kernel.htm</a> -- Application of tree kernel to SVM, on Alessandro Moschitti web-page.</li></ul></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-05-28" href="https://en.wikipedia.org/wiki/?title=Tree_kernel&amp;oldid=1292719641">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>

</body></html>